﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LinqToSqlDeptEmpl
{
    class Program
    {
        static void Main(string[] args)
        {
            Linq1();
            //Linq2();
            //Linq3();
            //Linq4();
            //Linq5();
            //Linq6();
            //Linq7();
            //Linq8();
            //Linq9();
            //Linq10();
            Console.ReadLine();
        }

        /// <summary>
        /// 1 - Выведите список городов, где находятся подразделения компании.
        /// </summary>
        public static void Linq1()
        {
            var CityList = (
                from city in db.Depts
                orderby city.City
                select city.City)
                .Distinct();

            Console.WriteLine("City List:");
            foreach (var x in CityList)
            {
                Console.WriteLine(x);
            }
        }

        private static string connectionString = @"NASTYUSHOK-PC\MYSERVER;Initial Catalog=employees;Integrated Security=True";
        private static DataClasses1DataContext db = new DataClasses1DataContext(connectionString);
    }
}
